<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <ui:composition template="./BannersAndMenusTemplate.jsf">

            <ui:define name="content"> 

                <h:form id="formForDetailsTable"> 
                    <p:panel header="Reference: #{user.selectedReference.title}">

                        <table width="500xp" align="center" border="1">   
                            <tr>  
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Title:" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.title}"/></td>   

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Year:" /> </td> 
                                <td><h:outputLabel value = "#{user.selectedReference.rYear}"/></td>
                            </tr>
                            <tr>
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Type:" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.type}"/></td>

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Edition" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.edition}"/></td>
                            </tr>
                            <tr>
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="City" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.city}"/></td>

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Doi" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.doi}"/></td>
                            </tr>
                            <tr>
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Isbn10" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.isbn10}"/></td>

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Isbn13" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.isbn13}"/></td>
                            </tr>
                            <tr>
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Pages" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.pages}"/></td>

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Volume" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.volume}"/></td>
                            </tr>
                            <tr>
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Subject" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.subject}"/></td>

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Issue" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.issue}"/></td>
                            </tr>
                            <tr>
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="URL" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.address}"/></td>

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Retrieve Date" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.date}"/></td> 
                            </tr>
                            <tr>
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Other" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.other}"/></td>

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Language" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReference.language}"/></td>
                            </tr>
                        </table>  

                    </p:panel> 
                </h:form>
                <p:panel header="Publisher"> 
                    <h:form id="formForPublisher" > 

                        <p:panel style="border:none" rendered="#{user.hasPub}"> 
                        <table width="500xp" align="center" border="1"  >  
                            <tr> 
                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Name:" /> </td>
                                <td><h:outputLabel value = "#{user.selectedReferencePub}"/></td>  

                                <td class="ui-state-default ui-filter-column" style="font-weight: bold; background-color: #ccc"><h:outputLabel  value="Country:" /> </td> 
                                <td><h:outputLabel value = "#{user.selectedReferencePubcountry}"/></td>  
                            </tr>
                        </table>  
                        </p:panel> 

  


                  
                        
                        <p:growl id="messages" showDetail="true" sticky="false"/>    
                        
                        <p:commandButton  value="Delete" icon="ui-icon-close"    
                                          onclick="confirmation.show();"/>      
                        
                        <p:confirmDialog id="confirmDialog" message="Are you sure about delete the Publisher?"  
                                                 header="Delete Publisher!" severity="alert" widgetVar="confirmation">  
 
                                    <p:commandButton id="confirm" value="Yes" update=":formForPublisher" oncomplete="confirmation.hide()"  
                                                     actionListener = "#{user.deletePub}" ajax="true"/>   
                                    <p:commandButton id="decline" value="No" onclick="confirmation.hide();" type="button" />   

                                </p:confirmDialog>  

                        <p:commandButton  id="showDialogButton" type="button" value="Add/Edit" icon="ui-icon-pencil"  
                                          action = "#{user.gotoEditReference}" onclick="dlg.show();" /> 


                        <p:dialog header="Enter FirstName" widgetVar="dlg" resizable="false">  
                            <h:form id="form">  

                                <h:panelGrid columns="2" style="margin-bottom:10px">  
                                    <h:outputLabel for="firstname" value="Name:" />  
                                    <p:inputText id="firstname" value="#{user.selectedReferencePub}" />  
                                    <h:outputLabel for="ccc" value="Country:" />  
                                    <p:inputText id="ccc" value="#{user.selectedReferencePubcountry}" />  
                                </h:panelGrid>  

                                <p:commandButton id="submitButton" value="Submit" actionListener="#{user.addEditPub}" ajax="false" oncomplete="dlg.hide();"/>  

                            </h:form>  
                        </p:dialog>
                    </h:form> 
                </p:panel>
                <h:form id="formForProblematicAuthorsDatatable"> 
                    <p:panel header="Authors">

                        <p:dataTable id="dataTable5" var="Author" value="#{user.allAuthorsOfthisRef}" widgetVar="Author"   
                                     emptyMessage="No Authors found with given criteria" 
                                     selection="#{user.selectedAuthor}" selectionMode="single"  rowKey="#{Author.id}">   


                            <f:facet name="footer">      

                                <p:commandButton id="showDialogButton111" type="button" value="Add" icon="ui-icon-refresh"
                                                 action="#{user.gotoLinkA()}" onclick="dlg2.show();"/>    


                                <p:dialog header="Add Author" widgetVar="dlg2" resizable="false">  
                                    <h:form id="form111">   

                                       <!-- <h:panelGrid columns="2" style="margin-bottom:10px">  

                                            <h:panelGrid columns="4" cellpadding="5">  



                                                <h:panelGrid columns="2" cellpadding="5">-->
                                                    <h:outputLabel value="Name :" for="acSimple" />    
                                                    <p:autoComplete id="acSimple" dropdown="true" value="#{user.txt1}"   
                                                                    completeMethod="#{user.complete}"/>   


                                                <!--</h:panelGrid> 
                                                   <p:outputPanel id="customPanel">  
                                                       <p:selectOneRadio id="customRadio" value="#{user.number1}" layout="custom">  
                                                           <f:selectItem itemLabel="Option 1" itemValue="1" />  
   
   
                                                       </p:selectOneRadio> 
                                                       <h:panelGrid columns="2">  
                                                           <h:outputLabel for="opt1" value="Use this Author" /> 
                                                           <p:radioButton id="opt1" for="customRadio" itemIndex="0"/>  
   
   
   
   
                                                       </h:panelGrid>  
                                                   </p:outputPanel> 
                                            </h:panelGrid> 

                                        </h:panelGrid>  -->


                                        <p:commandButton id="saveButton3" value="Add" actionListener = "#{user.linkAuthor()}" ajax="false" oncomplete="dlg2.hide();"/> 
                                        <p:commandButton id="saveButton2" value="Create Author" action = "page3119.jsf?faces-redirect=true" disabled="true"/> 

                                    </h:form>  
                                </p:dialog>

                                <p:commandButton id="submitButton1111" value="Remove" icon="ui-icon-close"
                                                 action="#{user.unlinkAuthor()}"/> 

                            </f:facet>






 
                            <p:column   
                                      headerText="Name"  
                                     >  
                                <h:outputText value="#{Author.name}" />   </p:column> 

                            <p:column   
                                       headerText="Surname"  
                                      >  
                                <h:outputText value="#{Author.surname}" />  </p:column> 


                            <p:column  
                                       headerText="Other names"   
                                       >  

                                <h:outputText value="#{user.getSample(Author.names)}"  />


                            </p:column>  

                        </p:dataTable> 



                    </p:panel>
                </h:form>
                <h:form id="formForTranslators"> 
                    <p:panel header="Translators"> 
                        <p:dataTable id="dataTable6" var="Translator" value="#{user.allTranslatirsOfthisRef}" widgetVar="Translator"   
                                     emptyMessage="No Translators found with given criteria" 
                                     selection="#{user.selectedTranslator}" selectionMode="single"  rowKey="#{Translator.id}">   

                            <f:facet name="footer">      


                                <p:commandButton id="showDialogButton222" type="button" value="Add" icon="ui-icon-refresh"
                                                 action = "#{user.gotoLinkTA()}" onclick="dlg3.show();"/>    


                                <p:dialog header="Add Translator" widgetVar="dlg3" resizable="false">  
                                    <h:form id="form222">   

                                       <!-- <h:panelGrid columns="2" style="margin-bottom:10px">  

                                            <h:panelGrid columns="4" cellpadding="5">  



                                                <h:panelGrid columns="2" cellpadding="5">-->
                                                    <h:outputLabel value="Name :" for="acSimple" />    
                                                    <p:autoComplete id="acSimple" dropdown="true" value="#{user.txt1}"   
                                                                    completeMethod="#{user.complete}"/>   


                                               <!-- </h:panelGrid> 
                                                <p:outputPanel id="customPanel">  
                                                    <p:selectOneRadio id="customRadio" value="#{user.number1}" layout="custom">  
                                                        <f:selectItem itemLabel="Option 1" itemValue="1" />  


                                                    </p:selectOneRadio> 
                                                    <h:panelGrid columns="2">  
                                                        <h:outputLabel for="opt1" value="Use this Author" /> 
                                                        <p:radioButton id="opt1" for="customRadio" itemIndex="0"/>  




                                                    </h:panelGrid>  
                                                </p:outputPanel> 
                                            </h:panelGrid> 

                                        </h:panelGrid>   -->


                                        <p:commandButton id="saveButton3" value="Add" actionListener = "#{user.linkTAuthor()}" ajax="false" oncomplete="dlg3.hide();"/> 
                                        <p:commandButton id="saveButton2" value="Create Author" action = "page3119.jsf?faces-redirect=true" disabled="true"/> 

                                    </h:form>  
                                </p:dialog>


                                <p:commandButton value="Remove" icon="ui-icon-close"
                                                 action="#{user.unlinkTAuthor()}"/> 

                            </f:facet>     

                            <p:column       
                                      headerText="Name"  
                                     >  
                                <h:outputText value="#{Translator.name}" />   </p:column> 

                            <p:column    
                                       headerText="Surname"  
                                       >  
                                <h:outputText value="#{Translator.surname}" />  </p:column> 

                            <p:column    
                                       headerText="Other names"   
                                      >  

                                <h:outputText value="#{user.getSample(Translator.names)}"  />


                            </p:column> 


                        </p:dataTable>
                    </p:panel>
                </h:form>


            </ui:define>

        </ui:composition>
    </h:body>
</html>

